package worker.control;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import worker.model.service.MemberService;
import worker.model.vo.DefectsVO;
import worker.model.vo.ItemInfoVO;
import worker.model.vo.MemberVO;
import worker.model.vo.OperationsVO;

public class MemberController extends MultiActionController {
	private MemberService memberService;
	
	public void setMemberService(MemberService memberService) {
		this.memberService = memberService;
	}
	public ModelAndView main(HttpServletRequest request, HttpServletResponse response,MemberVO mvo) throws SQLException{
		System.out.println("main join..");
		return new ModelAndView("main/member/member_register");
	}
	
	public ModelAndView register(HttpServletRequest request, HttpServletResponse response,MemberVO mvo) throws SQLException{
		System.out.println("register join..");
		mvo.setMem_level("W");
		System.out.println(mvo);
		memberService.register(mvo); 
		request.getSession().setAttribute("vo", mvo);
		return new ModelAndView("index");
	}
	public ModelAndView checkId(HttpServletRequest request,HttpServletResponse response) throws SQLException{
		boolean flag=false;
		flag=memberService.checkId(request.getParameter("mem_id"));
		//System.out.println(flag);
		return new ModelAndView("JsonView","checkId",flag); 
	}
	
}
